package com.chensf.studydemo.common

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View

class StripView :View{
    private val paint:Paint = Paint()
    private val space = 3f
    private val strokeWidth = 12f

    constructor(context: Context) : this(context, null)
    constructor(context: Context, attributeSet: AttributeSet?) : this(context, attributeSet, 0)
    constructor(context: Context, attributeSet: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attributeSet,
        defStyleAttr
    ){
        paint.style = Paint.Style.STROKE
        paint.isAntiAlias = true
        paint.strokeWidth = strokeWidth
        paint.color =Color.parseColor("#F3F7FF")
    }

    override fun onDraw(canvas: Canvas) {
        val width = measuredWidth
        val height = measuredHeight
        canvas.rotate(45f)
        for(index in 0..200){
            canvas.drawLine(index*(strokeWidth+space), (0-height*10).toFloat(),index*(strokeWidth+space), (10*height).toFloat(),paint)
        }
    }
}